using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.DAL;
using System.Data.SqlClient;
using System.Data;

namespace Entity
{
    [System.ComponentModel.DataObject]
    public class TblEmailTemplateExtended : TblEmailTemplate
    {
        public static CustomCollection<TblEmailTemplate> GetEmailTemplateByTitle(string emailTitle)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@EmailTitle", SqlDbType.NVarChar, 50, ParameterDirection.Input, emailTitle);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_EMAILTEMPLATE_GET_ACTIVE_EMAILTEMPLATE_BY_EMAIL_TITLE);
            GenerateCollectionFromReader reader = new GenerateCollectionFromReader(GenerateTblEmailTemplateCollectionFromReader);
            CustomCollection<TblEmailTemplate> objCollection = ((CustomCollection<TblEmailTemplate>)ExecuteReaderCmd(sqlCmd, reader));
            return objCollection;
        }

        private const string SP_TBL_EMAILTEMPLATE_GET_ACTIVE_EMAILTEMPLATE_BY_EMAIL_TITLE = "sp_TblEmailTemplate_Get_Active_EmailTemplate_By_EmailTitle";
    }
}
